﻿

namespace System.Extensions.Internal
{
  using System;
  using System.ComponentModel;
  using System.Extensions.Properties;

  /// <summary>
  /// Provides a localizable way to get designer descriptions.
  /// </summary>
  [AttributeUsage(AttributeTargets.All)]
  public class SRDescriptionAttribute : DescriptionAttribute
  {
    private bool replaced;

    public SRDescriptionAttribute(string description)
      : base(description)
    {
    }

    public override string Description
    {
      get
      {
        if (!this.replaced)
        {
          this.replaced = true;
          this.DescriptionValue = Resources.ResourceManager.GetString(base.Description);
        }

        return base.Description;
      }
    }
  }
}
